"""
map()
map(func, *iterables) --> map object

    Make an iterator that computes the function using arguments from
    each of the iterables.  Stops when the shortest iterable is exhausted.
"""
from collections import Iterable, Iterator

list1 = [1, 2, 3]
list2 = [4, 5, 6, 7]


def func1(x):
    return 2 * x


def func2(x, y):
    return x + y


# 生成一个迭代器
# it1 = map(func1,list1)
it1 = map(lambda x: 2 * x, list1)
print(isinstance(it1, Iterator))
for i in it1:
    print(i, end=' ')
print()
print('-------------------')
# it2 = map(func2,list1,list2)
it2 = map(lambda x, y: x + y, list1, list2)
for i in it2:
    print(i, end=' ')
print()
print('--------------------')
